
import 'package:flutter/material.dart';

class ImageTextButton extends StatelessWidget {
  final String imagePath;
  final String text;
  final TextStyle? textStyle;
  final VoidCallback onPressed;
  final double width;
  final double height;

  const ImageTextButton({
    required this.imagePath,
    required this.text,
    required this.textStyle,
    required this.onPressed,
    this.width = 200,
    this.height = 50,
  });

  @override
  Widget build(BuildContext context) {
    return SizedBox(
      width: width,
      height: height,
      child: ElevatedButton(
        style: ElevatedButton.styleFrom(
          padding: EdgeInsets.zero,
          backgroundColor: Colors.transparent,
          shadowColor: Colors.transparent,
          shape: RoundedRectangleBorder(
            borderRadius: BorderRadius.circular(8),
          ),
        ),
        onPressed: onPressed,
        child: Stack(
          children: [
            Container(
              decoration: BoxDecoration(
                borderRadius: BorderRadius.circular(0),
                image: DecorationImage(
                  image: AssetImage(imagePath),
                  fit: BoxFit.cover,
                ),
              ),
            ),
            Center(
              child: Text(
                text,
                style: textStyle ?? const TextStyle(
                  color: Colors.black,
                  fontSize: 12,
                  fontWeight: FontWeight.bold,
                ),
              ),
            ),
          ],
        ),
      ),
    );
  }
}
